package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Employee;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealVO;
import lombok.extern.java.Log;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface SetmealMapper {
    @AutoFill(value = OperationType.INSERT)
    void addSetmeal(Setmeal setmeal);

    Page<SetmealVO> getSetmealAll(SetmealPageQueryDTO setmealPageQueryDTO);
    @Select("select * from setmeal where id = #{id}")
    Setmeal getById(Long id);

    void deleteBatch(List<Long> ids);
    @AutoFill(value = OperationType.UPDATE)
    void updateSetmeal(Setmeal setmeal);

    List<DishItemVO> getSetmealByType(Integer type);

    List<Setmeal> getSetmealByCategoryId(Integer categoryId);
    List<Setmeal> getByCategoryId(Long categoryId);
    @Select("select * from setmeal where category_id = #{categoryId} and status = 1")
    List<Setmeal> getSetmealByCategoryIdWithStatus(Integer categoryId);

    /**
     * 根据条件统计套餐数量
     * @param map
     * @return
     */
    Integer countByMap(Map map);
}
